<template>
	<view class="container" style="flex-direction: column;">
		<!-- v-if="user_type==='联络人'"  -->
		<view class="back"  style="width: 100%;">
			<view  style="border-bottom: none;margin-left: 20rpx;font-size: 26rpx;font-weight: bold;">
				合同统计
			</view>
			<view class="" style="display: flex;justify-content: space-between;">
				<text class="title" v-for="(item,index) in dataObject.contentTab" :key="index">{{item}}</text>
				
			</view>
			<view class="container" v-for="(item, index) in dataObject.contractTongjilistData" :key="index">
				<text class="title" style="font-weight: normal">{{ item.key || 0 }}</text>
				<text class="title" style="font-weight: normal">{{ item.num  || 0}}</text>
				<text class="title" style="font-weight: normal">{{ item.num3  || 0}}</text>
				<text class="title" style="font-weight: normal">{{ item.num2  || 0}}</text>
				<text class="title" style="font-weight: normal">{{ item.num1  || 0}}</text>
				<text class="title" style="font-weight: normal">{{ item.num0  || 0}}</text>
				<text class="title"  style="color: #1D69FC;font-size: 25rpx;" @click="urlPopup(item,index,'合同')">催报</text>
			</view>
		</view>
		<view class="back"  style="width: 100%;margin-top:60rpx;">
			<view  style="border-bottom: none;margin-left: 20rpx;font-size: 26rpx;font-weight: bold;">
				记账统计
			</view>
			<view class="" style="display: flex;justify-content: space-between;">
				<text class="title" v-for="(item,index) in dataObject.jizhangTab" :key="index">{{item}}</text>
				
			</view>
			<view class="container" v-for="(item, index) in dataObject.jizhangListData" :key="index">
				<text class="title" style="font-weight: normal">{{ item.key || 0 }}</text>
				<text class="title" style="font-weight: normal">{{ item.num  || 0}}</text>
				<text class="title" style="font-weight: normal">{{ item.num1  || 0}}</text>
				<text class="title" style="font-weight: normal">{{ item.num0  || 0}}</text>
				<text class="title"  style="color: #1D69FC;font-size: 25rpx;" @click="urlPopup(item,index,'记账')">催报</text>
			</view>
		</view>
		
	    <popup  :dataPopup="dataPopup"  @makeChange="makeChange" @close="close"></popup>
		
	</view>
</template>

<script>
	import popup from './popup.vue'
	export default {
		components:{
			popup
		},
		name: 'total',
		props: {
			dataObject: {
				type: Object,
				default: () => {}
			}
		},
		watch: {
			dataObject: {
				immediate: true,
				handler(nVal, oVal) {
					console.log('获取上下获取上下获取上下获取上下',nVal)
					if (nVal) {
						this.liaison=nVal.liaison
						console.log('获取赋值后的',this.liaison)
						// let data = JSON.parse(JSON.stringify(nVal.imgList.list))
						// this.activityOne = nVal.imgList.list[0]
						// data.splice(0, 1)
						// this.activity = data
						// this.isShow = nVal.isShow.val
					}
				}
			}
		},
		data() {
			return {
				dataPopup:{},
				liaison:""//联络人姓名
			
			}
		},
		methods:{
			close:function(e){
				console.log('关闭')
				
			},
			// 短信。信息。电话点击事件
			makeChange:function(e){
				console.log('子组件弹窗传递过来的额参数是',e)
				if(e.type==1){
					// 通知
					this.$.toast('待开发')
				}else if(e.type==2){
					uni.makePhoneCall({
						 phoneNumber: e.item.phone
					});
				}else{
					this.makeSms(e.item)
				}
			},
			// 短信
			makeSms:function(item){
				var that = this
				uni.request({
				    method: 'POST',
				    url: 'https://jizhang.xqyu.cn/index.php/api/sms/send',
				    dataType: 'json',
				    header: {
				        'content-type': 'application/x-www-form-urlencoded'
				    },
				    data: {
				        mobile: item.phone,
						event:'yanzhangma'
				    },
				    success: function (res) {
						that.$.hideLoading()// 数据加载完成，隐藏弹窗
				        if (res.data.code == 1) {
							 that.$.successToast(res.data.msg)
							 setTimeout(function(){
								 let obj={
								 	isShowPopup:false,//是否显示弹窗
								 }
								that.dataPopup=obj
							 },1000)
				        }else {
							  that.$.toast(res.data.msg)
							  setTimeout(function(){
								  let obj={
								  	isShowPopup:false,//是否显示弹窗
								  }
								  that.dataPopup=obj
							  },1000)
						  }
				    }
				});
			},
			// // 催报点击事件
			// urlPopup:function(e){
			//    console.log('获取弹窗子组件里的参数ee获取弹窗子组件里的参数ee获取弹窗子组件里的参数ee获取弹窗子组件里的参数ee',e)
			// },
			// 详情弹窗
			urlPopup:function(item,index,content){
				this.dataPopup={
					item:item,
					index:index,
					isShowPopup:true,//是否显示弹窗
					selected:content,
					liaison:this.liaison,
				}
				console.log('详情弹窗了')
				
			},
		}
	}
</script>

<style  lang="scss" scoped>
  page{
		background-color: #FFFFFF !important;
	}
	.container {
	    display: flex;
	     padding: 0 10rpx;
		 justify-content: space-around;
	}
	.title {
	    font-size: 25rpx;
	    font-weight: bold;
	    color: #333333;
		padding: 15rpx 0;
	    line-height: 53rpx;
	    flex: 1;
	    text-align: center;
	    border-bottom: 1px solid #e5e5e5;
	    border-radius: 0px 0px 0px 0px;
		flex-wrap: nowrap;
	}
	.title-two{
		font-size: 25rpx;
		font-weight: bold;
		color: #333333;
		line-height: 53rpx;
		text-align: center;
		border-bottom: 1px solid #e5e5e5;
		border-radius: 0px 0px 0px 0px;
		padding: 13rpx;
	}
	.back{
		.name-content{
			width: 100rpx;
		}
	}
</style>
